var WxSearch = require('../../wxSearch/wxSearch.js')
Page({
  data: {
        showView: true ,
       
        ipic:"",
        iname:"",
        iarea:"",
        iid:"",
        ideatr:"",
        idesc:"",
        experience:"",
        dingjin:"300",
        fee:"",
        id:"",
        sousuo:""
  },
  onShow:function(){
    // wx.removeStorage({
    //   key: 'id'
    // });
    let that=this;
    wx.getStorage({
      key:'ipic',
      success:function(res){
     
        that.setData({
          ipic:res.data
        })
      }
    });
    wx.getStorage({
      key:'iname',
      success:function(res){
        console.log(res.data);
        that.setData({
          iname:res.data
        })
        wx.getStorage({
          key: 'iid',
          success: function (res) {

            that.setData({
              iid: res.data
            })
            console.log("获取查询ID：" + res.data)
            var thispage = this;
            wx.request({
              url: 'http://localhost:8080/show',
              data: {
                id: res.data
              },
              method: 'GET',
              header: {
                'content-type': 'application/json' // 默认值
              },
              success: function (res) {

                console.log("查询返回值：" + res)
                // console.log(res.data[0])
                // console.log(res.data[1])

                // thispage.setData({ Xiangmu: res.data })

              },
              complete: function (res) {

              }
            });
          }

        });
      }
    });
  
    wx.getStorage({
      key:'ideat',
      success:function(res){
        console.log(res.data);
        that.setData({
          ideat:res.data
        })
      }
    });
    wx.getStorage({
      key:'idesc',
      success:function(res){
        console.log(res.data);
        that.setData({
          idesc:res.data
        })
      }
    });
  
   
  

},


  dingdan: function (event) {
 
      wx.navigateTo({
        url: '../order/order'
     
  })
},

  onLoad: function (options) {
    console.log('onLoad')
    var that = this
   
    //初始化的时候渲染wxSearchdata
    WxSearch.init(that, 43, ['万盛金色城市', '毕桂花玉玺湾']);
    WxSearch.initMindKeys(['万盛金色城市', '毕桂花玉玺湾', '微信开发', '微信小程序']);
   // 生命周期函数--监听页面加载
   showView: (options.showView == "true" ? true : false)
   console.log()
   

 }
 , 

  wxSearchFn: function (e) {
    var that = this
    console.log(this.data.sousuo)
    WxSearch.wxSearchAddHisKey(that);

  },
  wxSearchInput: function (e) {
    var that = this
    console.log(e.detail.value)
    this.setData({sousuo: e.detail.value })
    WxSearch.wxSearchInput(e, that);
  },
  wxSerchFocus: function (e) {
    var that = this
    WxSearch.wxSearchFocus(e, that);
  },
  wxSearchBlur: function (e) {
    var that = this
    WxSearch.wxSearchBlur(e, that);
  },
  wxSearchKeyTap: function (e) {
    var that = this
    WxSearch.wxSearchKeyTap(e, that);
  },
  wxSearchDeleteKey: function (e) {
    var that = this
    WxSearch.wxSearchDeleteKey(e, that);
  },
  wxSearchDeleteAll: function (e) {
    var that = this;
    WxSearch.wxSearchDeleteAll(that);
  },
  wxSearchTap: function (e) {
    var that = this
    WxSearch.wxSearchHiddenPancel(that);
  },
 onChangeShowState: function () {
   
   var that = this;
  
   that.setData({
     showView: (!that.data.showView)
   })
   
 },
  changeIndicatorDots: function(e) {
    this.setData({
      indicatorDots: !this.data.indicatorDots
    })
  },
  changeAutoplay: function(e) {
    this.setData({
      autoplay: !this.data.autoplay
    })
  },
  intervalChange: function(e) {
    this.setData({
      interval: e.detail.value
    })
  },
  durationChange: function(e) {
    this.setData({
      duration: e.detail.value
    })
  },
  upper: function(e) {
    console.log(e)
  },
  lower: function(e) {
    console.log(e)
  },
  scroll: function(e) {
    console.log(e)
  },
  tap: function(e) {
    for (var i = 0; i < order.length; ++i) {
      if (order[i] === this.data.toView) {
        this.setData({
          toView: order[i + 1]
        })
        break
      }
    }
  },
  onChangeShowState:function(){
  var that=this;
  that.setData({
   showView:(!that.data.showView)
  })
},
  tapMove: function(e) {
    this.setData({
      scrollTop: this.data.scrollTop + 10
    })
  }
 
})
